import 'package:dio/dio.dart';

import 'dio/BaseModel.dart';
import 'dio/DioClient.dart';

class ShareApi {


  Future<BaseModel> deleteById(int shareId) async {
    // 发送PUT请求并传递FormData
    BaseModel response = await DioClient().doDio(
        "/share/deleteById/$shareId",
        method: HTTPMethod.get,
        // data: formData, // 使用FormData作为数据
        loading: true
    );
    return response;
  }




  //获取已经分享的用户
  Future<BaseModel> getUserPhone(String stringData) async {
    BaseModel response =  await DioClient().doDio(
        "/share/getUserPhone?stringData=$stringData",
        method: HTTPMethod.get,
        loading: true
    );

    return response;
  }


  //分享权限设置
  Future<BaseModel> deviceShare(Map<String, dynamic> formData) async {
    BaseModel response =  await DioClient().doDio(
        "/share/deviceShare",
        method: HTTPMethod.post,
        data: formData,
        loading: true
    );
    return response;
  }



  //分享权限设置
  Future<BaseModel> updateShareAuth(Map<String, dynamic> formData) async {
    BaseModel response =  await DioClient().doDio(
        "/share/updateShareAuth",
        method: HTTPMethod.post,
        data: formData,
        loading: true
    );
    return response;
  }


  //时间段设置
  Future<BaseModel> updateDataSelect(Map<String, dynamic> formData) async {
    BaseModel response =  await DioClient().doDio(
        "/share/updateDataSelect",
        method: HTTPMethod.post,
        data: formData,
        loading: true
    );
    return response;
  }



  //获取已经分享的用户
  Future<BaseModel> getShareList(int deviceId) async {
    BaseModel response =  await DioClient().doDio(
        "/share/getShareList?deviceId=$deviceId",
        method: HTTPMethod.get,
        loading: true
    );

    return response;
  }



  Future<BaseModel> getShareInfo(int shareId) async {
    BaseModel response = await DioClient().doDio(
        "/share/getInfo/$shareId",
        method: HTTPMethod.get,
        loading: true
    );
    return response;
  }





}